<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
<%@ taglib prefix="sec"
	uri="http://www.springframework.org/security/tags"%>

<s:include value="../header.jsp"></s:include>
<s:include value="../leftNav.jsp"></s:include>

<div id="content">

<div id="tabs">
	<ul>
		<li><s:a href="#tabs-1" action="testActionJsp.action">Issues list</s:a></li>
	</ul>
	<div id="tabs-1">
	
	<s:form name="addForm" action="chooseIssuesList.action" method="post" theme="xhtml">
		<s:select label="Choose List of Issues" 
			headerKey="-1" headerValue="Select issues list"
			list="filterList" 
			name="listChoosen" 
			value="Assigned to me" />
		<s:submit type="button" name="Add" label="Select" />
	</s:form>
	
		<s:if test="issues.size > 0">
			<table id="issues">
				<tr>
					<td>id</td>
					<td>Author</td>
					<td>Title</td>
					<td>Priority</td>
					<td>Status</td>
					<td>Type</td>
					<td>Estimation</td>
				</tr>
				<s:iterator value="issues" status="issuesStatus">
					<s:if test="#issuesStatus.even == true">
						<tr style="background-color: green;">
							<s:url id="showIssue" value="showIssue.action">
								<s:param name="issueId" value="issueId" />
							</s:url>
							<td><s:a href="%{showIssue}">
									<s:property value="issueId" />
									</s:a>
							</td>
							<td><s:a href="%{showIssue}">
									<s:property value="author" />
									</s:a>
							</td>
							<td><s:a href="%{showIssue}"><s:property value="title" /></s:a></td>
							<td><s:property value="priority" /></td>
							<td><s:property value="status" /></td>
							<td><s:property value="type" /></td>
							<td><s:property value="estimationHours" />(h)</td>
							<sec:authorize access="hasRole('ROLE_ADMIN')">
								<td><s:url id="deleteIssue" value="deleteIssue.action">
								<s:param name="issueId" value="issueId" />
								</s:url> <s:a href="%{deleteIssue}">Delete</s:a></td>
							</sec:authorize>
						</tr>
					</s:if>
					<s:else>
						<tr>
							<s:url id="showIssue" value="showIssue.action">
								<s:param name="issueId" value="issueId" />
							</s:url>
							<td><s:a href="%{showIssue}">
									<s:property value="issueId" />
									</s:a>
							</td>
							<td><s:a href="%{showIssue}">
									<s:property value="author" />
									</s:a>
							</td>
							<td><s:property value="creationDate" /></td>
							<td><s:property value="customerId" /></td>
							<td><s:property value="projectId" /></td>
							<td><s:property value="status" /></td>
							<td><s:property value="type" /></td>
							<td><s:url id="deleteIssue" value="deleteIssue.action">
								<s:param name="issueId" value="issueId" />
							</s:url> <s:a href="%{deleteIssue}">Delete</s:a></td>
						</tr>
					</s:else>
				</s:iterator>
			</table>
		</s:if>
	</div>
</div>